<template>
	<view class="lssued-box">
		<u-navbar back-icon-name="arrow-left" title="发布" v-if="1" title-color="#000000" :title-bold="true" :border-bottom="false">
		</u-navbar>
		
		
		
		<view class="lssued-center" style="color: #000000;">
			<view class="">
				<view class="">
					<i class="cuIcon-title mr18 f32"></i>
					<text>邀约类型</text>
				</view>
				<view class="flex align-center flex-wrap pt30 pl18">
					<view class="border-pad" v-for="(item, index) in classList" :key="index" @click="tabName(index, item.num)" :class="nameunm == index ? 'bgcText' : ''">
						{{item.name}}
					</view>
				</view>

				<view class="mt50">
					<i class="cuIcon-title mr18 f32"></i>
					<text>邀约成功人数</text>
				</view>
				<view class="flex align-center flex-wrap pt30 pl18">
					<view class="border-pad" v-for="(item, index) in classListFrom" :key="index" @click="addBgc(index,item.id)" :class="muni == index ? 'bgcText' : ''">
						{{item.name}}
					</view>
				</view>

				<view class="mt50">
					<i class="cuIcon-title mr18 f32"></i>
					<text>邀约主题</text>
				</view>
				<view class="flex align-center flex-wrap pt30 pl18">
					<view class="border-pad-mb" v-for="(item, index) in getListFrom" @click="addTheme(index,item.id)" :key="index" :class="theme == index ? 'bgcText' : ''">
						{{item.theme}}
					</view>
				</view>

				<view class="mt50">
					<i class="cuIcon-title mr18 f32"></i>
					<text>上传图片</text>
				</view>
				<view class="pl46 mt38">
					<u-upload :action="action" @on-success="successImg" @on-remove="removeImg" max-count="1"></u-upload>
				</view>

				<view class="flex justify-center mt266 mb100">	
					<button type="default" class="cu-btn w500 h80 r40 f30 bg-black "
						style="color: #FFFFFF; background-color: #000000;"
						@click="setStor">下一步</button>
				</view>
			</view>
		</view>

		<view class="foot_box"></view>
		<!-- 加载提示 -->
		<yy-loading text="加载中.." mask="true" click="true" ref="loading"></yy-loading>
		<!-- 信息提示-->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				classList: [{
					name: '普通',
					num: 1,
				}, {
					name: '急约',
					num: 2,
				}],
				classListFrom: [{
					name: '不展示',
					id: 2
				}, {
					name: '展示',
					id: 1
				}],
				list: [{
					text: '约饭'
				}, {
					text: '演出展览'
				}, {
					text: '喝酒蹦迪'
				}, {
					text: '看电影'
				}, {
					text: '密室桌游'
				}],
				action: this.UPLOADFILE,
				muni: 0,
				nameunm: 0,
				theme: 0,
				getListFrom: [],
				imgUrl: '',
				themeId: '',
				uni: 2,
				yueding: 1,
			};
		},
		onShow() {},
		onLoad(e) {
			this.getList()
		},
		methods: {
			async getList() {
				const res = await this.$u.get('api/user/theme/list')
				this.getListFrom = res.data
 			},
			
			addBgc(index,id) {
				this.muni = index
				this.uni = id
			},
			
			tabName(index,id) {
				this.nameunm = index
				this.yueding = id
				console.log('id==>', id);
			},
			
			addTheme(index,id) {
				this.theme = index
				this.themeId = id
			},
			
			successImg(e) {
				this.imgUrl = e.data
			},
			
			removeImg() {
				this.imgUrl = ''
			},
			
			setStor() {
				var obj = {
					imgUrl: this.imgUrl,
					themeId: this.themeId ? this.themeId : this.getListFrom[0].id,
					yueding: this.yueding,
					uni: this.uni,
				}
				uni.setStorageSync('objInit', obj)
				this.l.to('/pages/home/lssuedInfo')
			}
		}
	};
</script>`

<style lang="scss" scoped>
	.lssued-box {

		.lssued-center {
			padding: 30rpx;

			.border-pad {
				padding: 18rpx 30rpx;
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 500;
				border-radius: 40rpx;
				margin-right: 30rpx;
				color: #333333;
				border: 1rpx solid #F0F0F0;
			}

			.border-pad-mb {
				padding: 18rpx 30rpx;
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 500;
				border-radius: 40rpx;
				margin-right: 20rpx;
				margin-bottom: 20rpx;
				color: #333333;
				border: 1rpx solid #F0F0F0;
			}

			.border-pad-mb:nth-child(4n) {
				margin-right: 0rpx;
			}
		}
		
		.bgcText {
			color: #FFFFFF !important;
			background-color: #000000;
		}
	}
</style>
